﻿<!DOCTYPE html>
<html>

<head>
	<meta charset=utf-8>
	<title>Network</title>
	<link href="../base.css" rel="stylesheet" type="text/css" />
</head>

<body>
	<div class="main">
		<h1>Network</h1>
		
		<h2>Overview</h2>
		<p>
Effekseer embed the server function on the application side,
While the application is running, you can change the effect used by the application from Effekseer in real time.
		</p>

		<h2>Setting of the server function</h2>
		<p>
Please refer "Runtime/NetworkServer.sln".
		</p>
		<p>
To create a server you call the "::Effekseer::Server::Create" function.
To start the server, you call the "::Effekseer::Server::Start" function.
You can set the port number when you start the application.
Effects make real-time changes after connecting with Effekseer.
		</p>

<pre>
<code>
static ::Effekseer::Server* g_server = NULL;

// Create a server
g_server = Effekseer::Server::Create();

// Start the server with port number 60000
g_server->Start( 60000 );

</code>
</pre>

		<h2>Registering of effects</h2>
<p>
You need to register the effect you want to change from Effekseer on the server.
An effect is registered with "Effekseeer::Server::Regist". It is necessary to set a character string when registering.
For this string, specify a name that does not include the extension of the source file of the effect you want to edit.
For example, please set the character string "test" as the target to send "test.efkproj" change.
In other words, if the file name is different only in the directory, the change may not be applied correctly.
</p>

<pre>
<code>
g_server->Register( u"test", g_effect );
</code>
</pre>

		<h2>Updating server</h2>
<p>
The server needs to update every frame before updating "Effekseer::Manager".
</p>

<pre>
<code>
g_server->Update();
</code>
</pre>

<p>
For example, if you register an effect on the server with the name "test" and edit the file "test.efkproj"
The effect displayed in the application will change in real time according to Effekseer's setting.
In addition, texture modification is possible if texture exists also on the application side.
</p>

		<h2>Setting of the client function</h2>
		<p>
Please refer "Runtime/NetworkClient.sln"
		</p>

		<p>
Although you rarely use it, you can change the effect not only from Effekseer but also with the client function.
Using "Effekseer::Client::Create", create a client and make a connection using "Effekseer::Client::Start".
Use "Effekseer::Client::Reload" for sending data.
		</p>

<pre>
<code>

static ::Effekseer::Client*　g_client = NULL;

// Create a server
g_client = Effekseer::Client::Create();

// Connet the client with port number 60000
g_client->Start( "127.0.0.1", 60000 );

// Send data
g_client->Reload( g_manager, u"test_reload.efk", u"test" );
</code>
</pre>

	</div>
</body>

</html>